/* started 7/8/2010 */
package cha.app.multiactivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MultiActivity extends Activity implements OnClickListener{
  private static final String TAG = "MultiActivity";
  private Button next, prev;

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    
    //set all gui components to objects
    next = (Button)findViewById(R.id.next_screen);
    prev = (Button)findViewById(R.id.prev_screen);
    
    //add action listeners
    next.setOnClickListener(this);
    prev.setOnClickListener(this);
  }

  @Override
  public void onClick( View v ) {
    Intent intent;
    if(v.equals(next)){
      Log.d(TAG, "Next Pressed");
      intent = new Intent(this, Screen2.class);
      Log.d(TAG, "Intent Created");
      startActivity(intent);
      Log.d(TAG, "Done");
    }
    else if(v.equals(prev)){
      startActivity(new Intent(this, Screen3.class));
    }
  }
}